<?php if(!defined('CALL')) exit('No direct script access allowed');

include_once 'lib/logger.class.php';
include_once 'model/db.class.php';

class mDBLog
{
	public static function Fix()
	{
		$user_id = $_REQUEST['viewer_id'];
		if($user_id == null) $user_id = 'null';
		$host_addr = $_SERVER['HTTP_HOST'];
		$user_agent = $_SERVER['HTTP_USER_AGENT'];
		$referer = $_SERVER['HTTP_REFERER'];
		$script = $_SERVER['SCRIPT_NAME'];
		$sql = "insert into vk_http_log(user_id, host_addr, user_agent, referer, script) ".
			"values($user_id, '$host_addr', '$user_agent', '$referer', '$script')";
		DB::i()->query($sql);
	}
}